Shader "Unlit/GenWhiteAndBlackTex"
{
    Properties
    {
        _WhiteColor("White Color", Color) = (1,1,1,1)
        _BlackColor("Black Color", Color) = (0,0,0,1)
    }
    SubShader
    {
        Tags
        {
            "RenderType"="Opaque"
        }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile_fog
            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            fixed4 _WhiteColor;
            fixed4 _BlackColor;

            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                // 基于UV坐标的整数部分来决定颜色
                int x = (int)(i.uv.x * 10) % 2; // 放大10倍以增加格子数量
                int y = (int)(i.uv.y * 10) % 2;

                if (x == y)
                    return _WhiteColor;
                else
                    return _BlackColor;
            }
            
            ENDCG
        }
    }
}
